package Legend.Story_Engine is

   Selected_Story_Item : Uint16_t := No_Item;

   type Scene_Story_Id is record
      Scene : Uint16_t;
      Story : Uint16_t;
   end record;

   procedure Invoke_Story (Script : Uint16_t);

   procedure Clear_Screen;

   procedure Show_Talk (Talk : Uint16_t; Icon : Uint16_t; Side : Uint16_t);

   procedure Gain_Item (Which : Item_Grid_Type);

   procedure Change_Story (Id : Scene_Story_Id; Story : Story_Type);

   function Is_Story_Item_Selected (Story_Item : Uint16_t) return Boolean;

   function Confirm_Fight return Boolean;

   function Fight (War : Uint16_t) return Boolean;

   procedure Set_Main_Map_Music (Music : Uint16_t);

   function Confirm_Sleep return Boolean;

   procedure Hire (Hero : Uint16_t);

   function Confirm_Hire return Boolean;

   procedure Sleep;

   procedure Light_On;

   procedure Light_Off;

   procedure Die(Mode : Uint16_t); 

   function Is_Hired(Hero : Uint16_t) return Boolean;

   procedure Modify_Map (
      Scene : Uint16_t;
      Layer : Map_Layer_Type;
      Where : Point_Type;
      Value : Uint16_t
      );

   function Is_Misc_Item_In_Bag (Item_Id : Uint16_t) return Boolean;

   procedure Set_My_Position (Where : Point_Type);

   function Is_Team_Full return Boolean;

   procedure Fire (Hero : Uint16_t);
   -- hero fire/rehire scripts : 0950 .. 0989 

   procedure Set_Team_MP_To_Zero;

   procedure Set_Hero_Poison_Skill (Hero : Uint16_t; Value : Int16_t);

   procedure Scroll_Map_As_Movie (From, To : Point_Type);

   procedure Incr_Script_Index(
      Id            : Scene_Story_Id;
      Delta_Indexes : Script_Of_Cause
      );

   procedure Play_Story_Movie (Movie : Story_Movie_Type);

   function Is_Morality_In_Range (
      Hero : Uint16_t;
      From : Int16_t;
      To   : Int16_t
      ) return Boolean;

   function Is_Attack_In_Range (
      Hero : Uint16_t;
      From : Int16_t;
      To   : Int16_t
      ) return Boolean;

   procedure Walk_To (From, To : Point_Type);

   function Is_Money_Enougth (Expected : Int16_t) return Boolean;

   procedure Add_Item_Count (Which : Item_Grid_Type);

   procedure Learn_Kongfu (
      Hero   : Uint16_t;
      Kongfu : Uint16_t;
      Silent : Boolean
      );

   procedure Incr_Wise_With_Hint (Hero : Uint16_t; Count : Int16_t);

   procedure Modify_Learned_Kongfu (
      Hero   : Uint16_t;
      Index  : Uint16_t;
      Kongfu : Uint16_t;
      Exp    : Int16_t
      );

   function Is_My_Sex_Equals_To (Value : Sex_Type) return Boolean;

   procedure Incr_My_Morality (Count : Int16_t);

   procedure Replace_Map_Picture (
      Scene_Id : Uint16_t;
      Layer_Id : Map_Layer_Type;
      Old_Pic  : Uint16_t;
      New_Pic  : Uint16_t
      );

   procedure Open_Scene (Scene_Id : Uint16_t);

   procedure Set_My_Face (Face : Face_Type);

   procedure Put_Item_To_NPC_Bag (
      NPC  : Uint16_t; 
      Item : Uint16_t; 
      Count : Int16_t
      );

   function Is_Woman_In_Team return Boolean;

   function Is_Item_In_Bag (Item_Id : Uint16_t) return Boolean;

   procedure Play_Story_Movies (M1, M2 : Story_Movie_Type);

   procedure Incr_Movement (Hero : Uint16_t; Count : Int16_t);

   procedure Incr_MP_Limit (Hero : Uint16_t; Count : Int16_t);

   procedure Incr_Attack (Hero : Uint16_t; Count : Int16_t);

   procedure Incr_HP_Limit (Hero : Uint16_t; Count : Int16_t);

   procedure Modify_MP_Type (Hero : Uint16_t; Value : Magic_Type);

   function Is_Items_In_Bag (Items : Uint16_Array) return Boolean;

   procedure Show_Random_Talk_By_Softboy;

   procedure Show_Morality;

   procedure Show_Fame;

   procedure Open_All_Scenes;

   function Is_Script_Index_Of_Space_Equals_To (
      Story_Id : Uint16_t;
      Script_Index : Uint16_t
      ) return Boolean;

   procedure Incr_My_Fame (Count : Int16_t);

   procedure Enter_Gaochangmigong;

   procedure Huashanlunjian;

   procedure Fire_Team;

   function Is_Story_Picture_Equals_To (
      Id       : Scene_Story_Id;
      Pic_Id   : Uint16_t
      ) return Boolean;

   function Is_All_Books_Placed return Boolean;

   procedure Play_Time_Machine_Movie (M1, M2 : Story_Movie_Type);

   procedure Modify_Sex (Hero : Uint16_t; Sex : Sex_Type);

   procedure Shopping;

   procedure Open_Random_Shop_System;

   procedure Scroll_Map_To (Where : Point_Type);

   procedure Play_Sound (Sound : Uint16_t);

   -----------------------------------------

   procedure Toggle_Debug_Mode;

   function Where_Is_The_Shop (Where : in out Point_Type) return Uint16_t;

   procedure Change_Shop_Position;



end Legend.Story_Engine;
